//
//  ThreeGuideCell.m
//  WE
//
//  Created by iMacOne on 15/11/23.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "ThreeGuideCell.h"
#import "Size.h"
#import "ToolUtil.h"
//@interface ThreeGuideCell ()
//
//@end
//#define GREENCOLOR [UIColor colorWithRed:95 / 255.0 green:180 / 255.0 blue:53 / 255.0 alpha:1.0]
//#define REDCOLOR [UIColor colorWithRed:240 / 255.0 green:100 / 255.0 blue:78 / 255.0 alpha:1.0]
//#define BLUECOLOR [UIColor colorWithRed:88 / 255.0 green:140 / 255.0 blue:253 / 255.0 alpha:1.0]
//

@implementation ThreeGuideCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        NSArray * arr = @[@"健康评估",@"营养调理",@"在线咨询"];
        NSArray * arr1 = @[@"疾病风险自测",@"疾病营养康复",@"营养在线指导"];
        NSArray * arr2 = @[GREENCOLOR,REDCOLOR,BLUECOLOR];
        for (int i = 0;i < 3; i++) {
            UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame = CGRectMake(i * 10 + 20 + i * (WindowWidth - 60)/3, 10, (WindowWidth - 60)/3, 60);
            btn.layer.masksToBounds = YES;
            btn.layer.cornerRadius = 5;
            btn.backgroundColor = arr2[i];
            btn.tag = 100 + i;
            [btn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside];
            UILabel * nameLbl = [[UILabel alloc] initWithFrame:CGRectMake(10 , 10, (btn.frame.size.width - 20), margin_15)];
            nameLbl.font = FONT(14);
            nameLbl.text = arr[i];
            nameLbl.textColor = [UIColor whiteColor];
            nameLbl.textAlignment = NSTextAlignmentCenter;

            UILabel *  idenLbl = [[UILabel alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(nameLbl.frame) + 5 , (btn.frame.size.width - 10), margin_10)];
            idenLbl.font = FONT(12);
            idenLbl.text = arr1[i];
            idenLbl.textColor = [UIColor whiteColor];
            idenLbl.textAlignment = NSTextAlignmentCenter;
            
            [btn addSubview:nameLbl];
            [btn addSubview:idenLbl];
            [self.contentView addSubview:btn];

        }
      
    }
    return self;
}
- (void)clickBtn:(UIButton *)btn
{
    [self.delegate doClickBtn:btn.tag cell:self];
}



@end
